NoSQL operator: gregorian
Translates selected date columns from Julian to calendar format.
Usage: gregorian [options] [column ...]
Options:
--input (-i) 'file'
Read input from 'file' instead of STDIN.
--output (-o) 'file'
Write output to 'file' instead of STDOUT.
--no-header (-N)
Strip header from output.
--last (-l)
If the input table contains duplicated column names
pick the last occurrence of each. The default is to
pick the first one. This is sometimes useful after
the 'jointable' operator.
--short (-S)
The year is expressed in two-digit format.
--computer (-c)
Output date format: yyyymmdd
--iso (-I)
Output date format: yyyy-mm-dd
--europe (-e)
Output date format: dd.mm.yyyy
--us (-u)
Output date format: mm/dd/yyyy
--separator (-s) 's'
Use 's' for the separator character in output dates,
as opposed to the default '.' and '/'
--help (-h)
Display this help text.
Notes:
This program converts Julian dates in selected columns to Gregorian.
It is used together with "julian" to perform math on dates.
References:
1. http://aa.usno.navy.mil/faq/docs/JD_Formula.html
2. Fliegel, H. F. and van Flandern, T. C. (1968).
Communications of the ACM, Vol. 11, No. 10 (October, 1968).
For example, let's suppose we have the following table:
$ cat date.rdb
Date
----
20011010
Here's how to compute the date corresponding to 100 days after
20011010:
julian Date < date.rdb |
compute 'Date=sprintf("%f",Date+100)' |
gregorian Date
Date
----
20020118
Note that we must instruct 'compute' not to switch to scientific
output notation. Without the sprintf(), simply doing a 'Date+=100'
would produce 2.45229e+06, which would then cause 'gregorian' to
compute a wrong date, due to insufficient precision in the output of
'compute'.